﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Infrastructure;
namespace Gama.Website
{
    public static partial class VisitContext
    {
        public static CookieManager Cookie { get { return CookieManager.Instance; } }
        public static SessionManager Session { get { return SessionManager.Instance; } }
        public static UserIdentity Visitor
        {
            get
            {
                var visitor = VisitContext.Session.Visitor;
                if (visitor == null)
                {                  
                    VisitContext.Session.Visitor = visitor = new UserIdentity().CreateGuest();
                }                
                return visitor;
            }
        }
        public static CartManager CartManager
        {
            get
            {
                var cartManager = VisitContext.Session.CartManager;
                if (cartManager.IsNull())
                {                    
                    VisitContext.Session.CartManager = cartManager = new CartManager();//.CreateNew();
                }
                return cartManager;
            }
        }
    }
}